package com.snail.billing.json;

import org.json.JSONException;
import org.json.JSONObject;

public class JsonValidateInfo extends JsonBase {

	private String sessionId;
	private String account;
	private boolean isMobileAuthed;
	private String mobile;
	private boolean isEmailAuthed;
	private String email;

	public JsonValidateInfo(String jsonString) {
		super(jsonString);
		try {
			if (getCode() == 1) {
				JSONObject json = new JSONObject(jsonString);
				if (json.has("sessionId")) {
					sessionId = json.getString("sessionId");
				}
				if (json.has("account")) {
					account = json.getString("account");
				}
				if (json.has("info")) {
					JSONObject json2 = new JSONObject(json.getString("info"));
					if (json2.has("isMobileAuthed")) {
						isMobileAuthed = json2.getString("isMobileAuthed").equals("1");
					}
					if (json2.has("mobile")) {
						mobile = json2.getString("mobile");
					}
					if (json2.has("isEmailAuthed")) {
						isMobileAuthed = json2.getString("isEmailAuthed").equals("1");
					}
					if (json2.has("email")) {
						email = json2.getString("email");
					}
				}
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}

	public String getSessionId() {
		return sessionId;
	}

	public String getAccount() {
		return account;
	}

	public boolean getIsMobileAuthed() {
		return isMobileAuthed;
	}

	public String getMobile() {
		return mobile;
	}

	public boolean getIsEmailAuthed() {
		return isEmailAuthed;
	}

	public String getEmail() {
		return email;
	}

}
